import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;


public class Node {
    private  String nodeName;
    private List<Map<String,Object>> ListData;
    private List<Node> children;
    private Node parent;

    public String getNodeName() {
        return nodeName;
    }

    public void setNodeName(String nodeName) {
        this.nodeName = nodeName;
    }

    public List<Map<String, Object>> getListData() {
        return ListData;
    }

    public void setListData(List<Map<String, Object>> listData) {
        ListData = listData;
    }

    public List<Node> getChildren() {
        return children;
    }

    public void setChildren(List<Node> children) {
        this.children = children;
    }

    public Node getParent() {
        return parent;
    }
    public void setParent(Node parent) {
        this.parent = parent;
    }

    //通过名称获取子节点
  public Node getChild(String childName){
        List<Node> child= children.parallelStream().filter(x->x.getNodeName().equals(childName)).collect(Collectors.toList() );
        if(child!=null&&child.size()==1){
            return child.get(0);
        }
        else {
            if(child==null){
                return  null;
            }
            else {
                return  null;
            }
        }
  }
}


